import HttpService from '@/service/httpService'
import ApiUrl from '@/service/apiConfig'

export const apiMixin = {
  methods: {
    /**
     * @desc 测试php接口
     */
    getDemoPHPApi(params) {
      return new Promise((resolve, reject) => {
        HttpService.call(ApiUrl.demoPHPApi, params || {}).then(
          data => {
            console.log('get demo php api data ', data)
            resolve(data)
          },
          err => {
            reject(err)
          }
        )
      })
    },
    /**
     * @desc 测试node接口
     */
    getDemoNodeApi(params) {
      return new Promise((resolve, reject) => {
        HttpService.nodeCall(ApiUrl.demoNodeApi, params || {}).then(
          data => {
            console.log('get demo php api data ', data)
            resolve(data)
          },
          err => {
            reject(err)
          }
        )
      })
    }
  }
}
